package com.liuyk.gif;

import androidx.annotation.NonNull;
import android.support.rastermill.FrameSequenceDrawable;

import com.bumptech.glide.load.resource.drawable.DrawableResource;

/**
 * DESC
 * <p>
 * Created by Administrator on 2019/12/2.
 */
public class GifResource extends DrawableResource<FrameSequenceDrawable> {

    public GifResource(FrameSequenceDrawable drawable) {
        super(drawable);
    }

    @NonNull
    @Override
    public Class<FrameSequenceDrawable> getResourceClass() {
        return FrameSequenceDrawable.class;
    }

    @Override
    public int getSize() {
        //内存大小
        return drawable.getIntrinsicHeight() * drawable.getIntrinsicWidth();
    }

    @Override
    public void recycle() {
        drawable.stop();
        drawable.destroy();
    }
}
